package com.xlh.enums.cs;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;

/**
 * @author zhr 2019/10/17
 */
@Getter
@AllArgsConstructor
public enum OperationTypeEnum {
    INSERT(1, "新增"),
    UPDATE(2, "修改"),
    DELETE(-1, "删除"),
    NO_OPERATE(0, "无操作");

    private Integer type;
    private String message;

    private static Map<Integer, OperationTypeEnum> typeEnumMap = Maps.newConcurrentMap();

    static {
        for (OperationTypeEnum operationTypeEnum : OperationTypeEnum.values()) {
            typeEnumMap.put(operationTypeEnum.getType(), operationTypeEnum);
        }
    }

    private OperationTypeEnum getOperation(Integer type) {
        return typeEnumMap.get(type);
    }
}
